/
IEndpointBuilder`1.cs
82 lines (75 loc) · 3.13 KB
/
IEndpointBuilder`1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2020 Sergio Aquilini
// This code is licensed under MIT license (see LICENSE file for details)
using System;
using Silverback.Messaging.Encryption;
using Silverback.Messaging.Serialization;
namespace Silverback.Messaging.Configuration
{
/// <summary>
/// Builds the <see cref="Endpoint" />.
/// </summary>
/// <typeparam name="TBuilder">
/// The actual builder type.
/// </typeparam>
public interface IEndpointBuilder<out TBuilder>
where TBuilder : IEndpointBuilder<TBuilder>
{
/// <summary>
/// Gets the type of the message being produced or consumed.
/// </summary>
/// <remarks>
/// This value might be used during the configuration to automatically determine some configurations (e.g. the
/// correct serializer to be used) without having to specify the message type once again.
/// </remarks>
Type? MessageType { get; }
/// <summary>
/// Specifies an optional friendly name to be used to identify the endpoint. This name can be used to
/// filter or retrieve the endpoints and will also be included in the <see cref="IEndpoint.DisplayName" />,
/// to be shown in the human-targeted output (e.g. logs, health checks result, etc.).
/// </summary>
/// <param name="friendlyName">
/// The friendly name.
/// </param>
/// <returns>
/// The endpoint builder so that additional calls can be chained.
/// </returns>
TBuilder WithName(string friendlyName);
/// <summary>
/// Specifies the <see cref="IMessageSerializer" /> to be used serialize or deserialize the messages.
/// </summary>
/// <param name="serializer">
/// The <see cref="IMessageSerializer" />.
/// </param>
/// <returns>
/// The endpoint builder so that additional calls can be chained.
/// </returns>
TBuilder UseSerializer(IMessageSerializer serializer);
/// <summary>
/// Enables the end-to-end message encryption.
/// </summary>
/// <param name="encryptionSettings">
/// The <see cref="EncryptionSettings" />.
/// </param>
/// <returns>
/// The endpoint builder so that additional calls can be chained.
/// </returns>
TBuilder WithEncryption(EncryptionSettings? encryptionSettings);
/// <summary>
/// Enables the message validation.
/// </summary>
/// <param name="throwException">
/// A value that specifies whether an exception should be thrown if the message is invalid.
/// </param>
/// <returns>
/// The endpoint builder so that additional calls can be chained.
/// </returns>
TBuilder ValidateMessage(bool throwException);
/// <summary>
/// Disables the message validation.
/// </summary>
/// <returns>
/// The endpoint builder so that additional calls can be chained.
/// </returns>
TBuilder DisableMessageValidation();
}
}